
#ifndef _M_APP_TOOLS_H_
#define _M_APP_TOOLS_H_

#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>

extern unsigned char g_ucDebug;

#define	SWITCH_ON     	1
#define	SWITCH_OFF     	0

/* the signpad debug switch configure */
#define DBG_OFF          0x00U
#define DBG_ON           0x80U

enum debug_level{
  D_DEBUG = 0,
  D_INFO = 1,
  D_WARNING = 2,
  D_ERROR = 3,
};
#define DEBUG_LEVEL       D_DEBUG
#define PLATFORM_DIAG(x) {console_log x;}

/***********************************/
#define SIGNAPAD_DEBUG    

#if defined SIGNAPAD_DEBUG
#define print_log(debug, message) do { \
                               if ((DBG_ON == g_ucDebug) && \
                                   (debug) >= DEBUG_LEVEL) { \
                                    PLATFORM_DIAG(message); \
                               } \
                             } while(0)
#else
#define print_log(debug, message) 
#endif
#define DEBUG_LOG   console_log("%s:%s@%d\n", __FILE__, __FUNCTION__, __LINE__)

void console_log(const char *format, ...);
void print_hex(char *pcTag, const unsigned char *pucData, unsigned int uiLen);

#endif


